package fruitsManage;

import java.util.Scanner;

public class FruitsTest {

	static Scanner scanner = new Scanner(System.in);

	public void List() {
		Fruits fruit = new Fruits();
		Purchase purchase = new Purchase();
		Sales sale = new Sales();
		while (true) {

			System.out.println("=========请选择========");
			System.out.println("=========1-水果管理====");
			System.out.println("=========2-进货记录管理========");
			System.out.println("=========3-销售记录管理========");
			System.out.println("=========4-收益========");
			System.out.println("=========5-退出========");

			int key  = 5;
			try {
				key = Integer.parseInt(scanner.nextLine());
			} catch (Exception e) {
			}

			if (key == 5)
				break;

			switch (key) {
			case 1:
				fruit.fruitsList();
				break;
			case 2:
				purchase.list();
				break;
			case 3:
				sale.list();
				break;
			case 4:
				money();
				break;
			default:
				break;
			}
			System.out.println();
			System.out.println("点击回车继续...");
			scanner.nextLine();
		}
	}
	
	public void money() {
		double money = Fruits.salesTotal - Fruits.bidTotal;//收益
		System.out.println("总进货价：" + Fruits.bidTotal + "元");
		System.out.println("总销售价：" + Fruits.salesTotal + "元");
		System.out.println("总收益：" + money + "元");
	}

	public static void main(String[] args) {
		Fruits fruit = new Fruits();
		FruitsTest fruitsTest = new FruitsTest();

		fruit.init();

		fruitsTest.List();

	}
}
